#ifndef masterpanel_h
#define masterpanel_h

#include "juce_amalgamated.h"
#include "ListPanels/PersistentFoodList.h"
#include "FoodObjects/DailyIntake.h"

class MainPanel;
class NutritionGuidePanel;
class MealListPanel;
class GroceryListPanel;
class FoodListPanel;
class UtilitiesPanel;
class CalendarPanel;

class Dimensions {
public:
	int width, height;
	Dimensions() :
		width(0), height(0) {
	}
	Dimensions(int w, int h) :
		width(w), height(h) {
	}
	void operator=(const Dimensions& d) {
		width = d.width;
		height = d.height;
	}
};

/**
 * This component contains all the pages of the GUI
 */
class MasterComponent: public Component {
private:
	int width, height;

	MainPanel* mainPanel;
	NutritionGuidePanel* nutritionPanel;
	MealListPanel* mealListPanel;
	FoodListPanel* foodListPanel;
	GroceryListPanel* groceryListPanel;
	UtilitiesPanel* utilitiesPanel;
	CalendarPanel* calendarPanel;

	Dimensions mdim, ndim, mldim, udim, gldim, fldim, cdim;

	void setPanelDimensions();
	void setPanelVisible(int panel, bool isVisible);

public:
	enum Panels {
		UTILITIES, NUTRITION, MEAL_LIST, FOOD_LIST, GROCERY_LIST, CALENDAR, MAIN
	};

	MasterComponent(int w, int h);
	void paint(Graphics& g);
	void switchPanels(int panelA, int panelB);
	void add(Component* component, Dimensions& dim);
	void resized(int newWidth, int newHeight);
};

#endif
